import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:xinxuan/utils/color_util.dart';

class RefreshUtil {
  static easyRefresh({Future<void> Function()? onLoad, Future<void> Function()? onRefresh, required List<Widget> slivers, ScrollController? scrollController}) {
    return EasyRefresh.custom(
      scrollController: scrollController,
      topBouncing: onRefresh == null ? false : true,
      header: onRefresh == null ? null : BallPulseHeader(
        color: bgRefresh
      ),
      bottomBouncing: onLoad == null ? false : true,
      footer: onLoad == null ? null : BallPulseFooter(
        enableHapticFeedback: true,
        enableInfiniteLoad: false,
        color: bgRefresh
      ),
      slivers: slivers,
      onLoad: onLoad,
      onRefresh: onRefresh
    );
  }
}